package cn.ljy.uem.dao;

import cn.ljy.authority.dao.BaseMapper;
import cn.ljy.uem.model.SchoolTeachingTaskLesson;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @description 教学任务课堂的数据层操作类
 * @author 廖振豪
 * @date 2022-11-29
 */
@Mapper
public interface SchoolTeachingTaskLessonMapper extends BaseMapper<SchoolTeachingTaskLesson> {

        @Select("select count(1) from school_teachingtask_student where teachingtask_id = #{taskId} and student_id=#{studentId}")
        Boolean isTaskStudentByStudentId(Integer taskId, Long studentId);
        /**
         *  判断该课堂是否是该教师创建 或者 是这个课堂对应教学任务下的老师
         *  0 false 表示 教师不存在该该课堂中 1 true 代表该课堂下有该教师
         * @param taskId
         * @param teacherId
         * @return
         */
        @Select("select count(1) from school_teachingtask_teacher where teachingtask_id = #{taskId} and teacher_id=#{teacherId}")
        Boolean isTaskTeacherByTeacherId(Integer taskId, Long teacherId);


        //通过教学任务id查找记录
//        @Select("select * from school_teachingtask_lesson where task_id = #{taskId} ORDER BY teaching_date desc")
        List<SchoolTeachingTaskLesson> findTaskLessonByTaskId(Integer taskId);
}
